home *** CD-ROM | disk | FTP | other *** search
- Path: news.unt.edu!cc0003
- From: cc0003@jove.acs.unt.edu (Chen-five Chi)
- Newsgroups: comp.lang.c++
- Subject: Question about abstract base class
- Date: 17 Apr 1996 23:15:08 GMT
- Organization: University of North Texas
- Message-ID: <4l3u1s$j80@hermes.acs.unt.edu>
- NNTP-Posting-Host: jove.acs.unt.edu
- X-Newsreader: TIN [version 1.2 PL2]
-
- I just wrote a simple program like this:
-
- class shape
-
- {
- public:
- virtual void print() const = 0;
- ........
- }
- clase TwoDimensionObject: public shape
- {
- public:
- virtual void area() const = 0;
- ...
- }
- class Square: public TwoDimensionObject
- {
- private:
- int side;
- public:
- virtual void area()
- {
- cout << "Square area: " << (side * side);
- }
- }
- ...
- void main()
- {
- Square s1;
- ....
- }
-
- ==============================
- And I get a compiler error in BC 4.51 said "s1 is abstract base class...."
- After I move the keyword "const", the program runs normally without any
- problem.
-
- I would like to know
- "Why I Could not put 'const' in the ABC? and the different these two?
-
- Your kindness help is appreciated.
-
- Steven
-
-